package com.eastfair.pay.enums;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 财务-》审核状态
 * </p>
 *
 * @author clm
 * @date 2022-12-06
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "PayApproveStatusEnum", description = "审核状态 #{PAY_NOT_APPROVED:审核不通过;PAY_APPROVED:审核通过-枚举")
public enum PayApproveStateEnum implements BaseEnum {

    /**
     * PAY_APPROVED="审核通过"
     */
    PAY_APPROVED("审核通过"),
    /**
     * PAY_NOT_APPROVED="审核不通过"
     */
    PAY_NOT_APPROVED("审核不通过"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static PayApproveStateEnum match(String val, PayApproveStateEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static PayApproveStateEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(PayApproveStateEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_PUNISH,HAS_PUNISH", example = "NOT_PUNISH")
    public String getCode() {
        return this.name();
    }

}
